/**
 * 2017年5月1日
 */
package cn.edu.bjtu.entity.impl.api;

import java.io.InputStream;
import java.net.URI;
import java.util.Map;
import java.util.concurrent.locks.ReadWriteLock;

import org.apache.http.HttpEntity;

import cn.edu.bjtu.constant.Constant;
import pojo.dto.services.ModelExistQueryMessage;


/**
 * @author Alex
 *
 */
public class Word2VecModelQueryContext extends Word2VecBaseContext<ModelExistQueryMessage>{
	String uri =  "/query/exist";
	
	public Word2VecModelQueryContext(ReadWriteLock lock) {
		super(lock);
	}
	
	@Override
	public Map<String, Object> getResultMapForRender() {
		return this.resultMap;
	}

	@Override
	public URI getURI() {
		return URI.create(uri);
	}
	private ModelExistQueryMessage mess;
	//修改，异步处理让父类去解决吧。有异常直接让父类接收，然后设置 ExecuteResult 的相应信息。自己不要处理了。
	@Override
	protected void handleResponseInputStream(InputStream in, HttpEntity entity) throws Exception{
		mess = om.readValue(in, ModelExistQueryMessage.class);	
		resultMap.put(Constant.COMMAND_RESULT, mess);
		this.msg =  "success";
	}
	@Override
	public ModelExistQueryMessage javaClassResult() {
		return mess;
	}

}
